<template>
  <view class="main-pd u-p-t-28">
    <view v-if="dataList.length && !loading">
      <view class="active-list">
        <view
          class="active-item"
          v-for="item in dataList"
          :key="item.activityId"
          @click="$u.route('/pagesA/hswy/dyhdfcDetail?id=' + item.activityId)">
          <view class="u-flex">
            <view class="u-m-r-26">
              <u-image
                :src="picUrl(item.picInfo)"
                width="220rpx"
                height="146rpx"
                radius="9rpx"></u-image>
            </view>
            <view class="u-flex-grow">
              <view class="title u-line-2">{{ item.title }}</view>
              <view class="color-999 font-26">{{ item.createTime }}</view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view class="u-m-30" v-show="loading">
      <u-skeleton rows="5" title loading></u-skeleton>
    </view>
    <view class="empty-con">
      <u-empty mode="list" :show="!dataList.length && !loading"></u-empty>
    </view>
  </view>
</template>

<script setup>
import { getDyhdfclistApi } from "@/api/index";
import { onLoad } from "@dcloudio/uni-app";
import { useList } from "@/hooks/useList";
import { computed, ref } from "vue";
import config from "@/config";
let wyId = ref("");
const { loadData, dataList, page, loading } = useList({
  listApi: getDyhdfclistApi,
  otherParam: { param: JSON.stringify({ wyId: wyId.value }) },
});
const picUrl = computed((url) => (url) => {
  let urlArr = url.split(",");
  return config.baseUrl + urlArr[0];
});
onLoad((param) => {
  page.value = 1;
  dataList.value = [];
  wyId.value = param.id;
  loadData({ param: JSON.stringify({ wyId: wyId.value }) });
});
</script>

<style lang="scss" scoped>
.active-item {
  border-bottom: 1rpx solid #f0f0f0;
  padding-bottom: 48rpx;
  margin-top: 32rpx;

  .title {
    font-size: 32rpx;
    color: #333;
    padding: 7rpx 0 58rpx 0;
  }
}
</style>
